/*
 * JHeuristics - The Java Meta-Heuritics Library
 * Copyright (C) 2004-2005, Universidade Federal de Campina Grande. All rights reserved.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package org.jheuristics.ga;

import java.io.Serializable;

import org.jheuristics.util.RandomGenerator;

/**
 * TODO
 *
 * @author Marcell Manfrin, marcell@ourgrid.org, Jan 9, 2006
 */
public class DefaultGAConfig implements GAConfig, Serializable {
    private IndividualsFactory individualsFactory;
    private Operator operator;
    private BulkFitnessEvaluator bulkFitnessEvaluator;
    private RandomGenerator randomGenerator;

    /**
     * TODO
     *
     * @param individualsFactory
     * @param operator
     * @param bulkFitnessEvaluator
     * @param randomGenerator
     */
    public DefaultGAConfig(IndividualsFactory individualsFactory, Operator operator, BulkFitnessEvaluator bulkFitnessEvaluator, RandomGenerator randomGenerator) {
        setIndividualsFactory(individualsFactory);
        setOperator(operator);
        setBulkFitnessEvaluator(bulkFitnessEvaluator);
        setRandomGenerator(randomGenerator);
    }

    /* (non-Javadoc)
     * @see org.jheuristics.ga.GAConfig#getIndividualsFactory()
     */
    public IndividualsFactory getIndividualsFactory() {
        return individualsFactory;
    }

    /* (non-Javadoc)
     * @see org.jheuristics.ga.GAConfig#setIndividualsFactory(org.jheuristics.ga.IndividualsFactory)
     */
    public void setIndividualsFactory(IndividualsFactory val) {
        if (null == val) {
			// TODO: ERROR MSG
            throw new NullPointerException();
        }
        this.individualsFactory = val;
    }

    /* (non-Javadoc)
     * @see org.jheuristics.ga.GAConfig#getOperator()
     */
    public Operator getOperator() {
        return operator;
    }

    /* (non-Javadoc)
     * @see org.jheuristics.ga.GAConfig#setOperator(org.jheuristics.ga.Operator)
     */
    public void setOperator(Operator val) {
        if (null == val) {
			// TODO: ERROR MSG
            throw new NullPointerException();
        }
        this.operator = val;
    }

    /* (non-Javadoc)
     * @see org.jheuristics.ga.GAConfig#getBulkFitnessEvaluator()
     */
    public BulkFitnessEvaluator getBulkFitnessEvaluator() {
        return bulkFitnessEvaluator;
    }

    /* (non-Javadoc)
     * @see org.jheuristics.ga.GAConfig#setBulkFitnessEvaluator(org.jheuristics.ga.BulkFitnessEvaluator)
     */
    public void setBulkFitnessEvaluator(BulkFitnessEvaluator val) {
        if (null == val) {
			// TODO: ERROR MSG
            throw new NullPointerException();
        }
        this.bulkFitnessEvaluator = val;
    }

    /* (non-Javadoc)
     * @see org.jheuristics.ga.GAConfig#getRandomGenerator()
     */
    public RandomGenerator getRandomGenerator() {
        return randomGenerator;
    }

    /* (non-Javadoc)
     * @see org.jheuristics.ga.GAConfig#setRandomGenerator(org.jheuristics.util.RandomGenerator)
     */
    public void setRandomGenerator(RandomGenerator val) {
        if (null == val) {
			// TODO: ERROR MSG
            throw new NullPointerException();
        }
        this.randomGenerator = val;
    }

}
